<template>
  <div>
    <!-- 头部 -->
    <div class="dark-top">
      <a @click="goback" class="page-back"><div></div></a>
      <div class="page-title">
        <font style="vertical-align: inherit;">电子协议</font>
      </div>
    </div>
    <!-- 内容 -->
    <div class="dark-body">
      <div class="content">
        {{ content }}
      </div>
    </div>
    <div style="height: 6.25rem"></div>
    <!-- 按钮 -->
    <div class="dark-botton">
      <div class="read-botton" @click="goPayAudit">确认阅读</div>
    </div>
  </div>
</template>

<script>
import { Indicator } from "mint-ui";
import { Toast } from "mint-ui";
export default {
  data() {
    return {
      level: "",
      content: "协议说明"
    };
  },
  created() {
    this.selectAgreement();
  },
  methods: {
    goback() {
      this.$router.go(-1);
    },
    //协议阅读后返回
    goPayAudit() {
      this.$router.push({
        name: "PayAudit",
        params: { agreementStatus: true }
      });
    },
    //获取协议
    selectAgreement() {
      Indicator.open({ spinnerType: "fading-circle" });
      let me = this;
      this.$axios
        .post("/api/apply/pay_agreement", { emulateJSON: true })
        .then(kun => {
          //console.log(kun);
          Indicator.close();
          if (kun.code == 200) {
            me.content = kun.data.content;
            me.level = kun.data.level;
          } else {
            Toast(kun.msg);
          }
        })
        .catch(function(error) {
          console.log(error);
        });
    }
  }
};
</script>

<style lang="scss" scoped>
//头部
.dark-top {
  width: 100%;
  height: 2.75rem;
  color: #1a1a1a;
  position: relative;

  /* 设置渐变 */
  background: rgb(255, 0, 0); /* Old browsers */
  background: -moz-linear-gradient(
    to right bottom,
    rgb(255, 127, 95) 10%,
    rgb(229, 39, 77) 70%
  ); /* FF3.6-15 */
  background: -webkit-linear-gradient(
    to right bottom,
    rgb(255, 127, 95) 10%,
    rgb(229, 39, 77) 70%
  ); /* Chrome10-25,Safari5.1-6 */
  background: linear-gradient(
    to right bottom,
    rgb(255, 127, 95) 10%,
    rgb(229, 39, 77) 70%
  ); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ff0000', endColorstr='#ffffff',GradientType=0 ); /* IE6-9 */

  .page-back {
    width: 0.5625rem;
    height: 0.9375rem;
    text-decoration: none;
    color: #ffffff;
    display: inline-block;
    position: absolute;
    left: 0.9375rem;
    top: 1.0625rem;

    :first-child {
      width: 100%;
      height: 100%;
      background-image: url(../../assets/login/return-white.png);
      background-repeat: no-repeat;
      background-size: contain;
      background-position: center;
      overflow: hidden;
    }
  }

  .page-title {
    font-size: 1.125rem;
    color: #ffffff;
    display: inline-block;
    position: absolute;
    left: 50%;
    top: 0.65rem;
    -ms-transform: translateX(-50%) translateY(0); /* IE 9 */
    -moz-transform: translateX(-50%) translateY(0); /* Firefox */
    -webkit-transform: translateX(-50%) translateY(0); /* Safari 和 Chrome */
    -o-transform: translateX(-50%) translateY(0); /* Opera */
  }
}

//内容
.dark-body {
  width: 21.5625rem;
  margin: 1.25rem auto;

  .content {
    font-size: 0.875rem;
    color: #666666;
  }
}

//按钮
.dark-botton {
  width: 100%;
  height: 6.25rem;
  position: fixed;
  bottom: 0;

  .read-botton {
    width: 21.5625rem;
    height: 3.0625rem;
    line-height: 3.0625rem;
    margin: auto;
    border-radius: 1.53125rem;
    text-align: center;
    font-size: 1.125rem;
    color: #ffffff;

    /* 设置渐变 */
    background: rgb(255, 0, 0); /* Old browsers */
    background: -moz-linear-gradient(
      to right bottom,
      rgb(255, 127, 95) 10%,
      rgb(229, 39, 77) 70%
    ); /* FF3.6-15 */
    background: -webkit-linear-gradient(
      to right bottom,
      rgb(255, 127, 95) 10%,
      rgb(229, 39, 77) 70%
    ); /* Chrome10-25,Safari5.1-6 */
    background: linear-gradient(
      to right bottom,
      rgb(255, 127, 95) 30%,
      rgb(229, 39, 77) 80%
    ); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ff0000', endColorstr='#ffffff',GradientType=0 ); /* IE6-9 */
  }
}
</style>
